import requests

a = 57
b = a+1
c = a+2

def register(username,password):
    r = requests.post('http://81.70.70.110:4396/account/register',params={
        'userName':username,
        'password':password,
    })
    print(r.json())
def login(userId,password):
    return requests.post('http://81.70.70.110:4396/account/login',params={
        'userId':userId,
        'password':password,
    }).json()['data']['token']

def contact(a,b):
    token = login(a,a)
    print(a,token)
    requests.post('http://81.70.70.110:4396/contact/add',params={
        'userId':a,
        'contactId':b,
    },headers={'token':token})

def addFriend(a,b):
    token = login(a,a)
    print(a,token)
    data = requests.post('http://81.70.70.110:4396/contact/request',params={
        'userId':a,
        'contactId':b,
        'type': "request",
    },headers={'token':token}).json()
    print(data)
def main():
    register(a,a)
    register(b,b)
    register(c,c)


#     addFriend(56,71)


main()


